//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.hice.demo.sbdbra.common.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.ResourceBundle;

public class Constants {
  private static Log log = LogFactory.getLog(Constants.class);
  private static ResourceBundle SETTINGS;
  private static File file = null;
  private static ResourceControl rc = new ResourceControl();
  private static long lastModified = 0L;

  public Constants() {
  }

  public static synchronized ResourceBundle getResourceBundle() {
    if(SETTINGS == null) {
      SETTINGS = ResourceBundle.getBundle("config/setting");
    }

    return SETTINGS;
  }

  public static int getIntValue(String key) {
    return Integer.parseInt(SETTINGS.getString(key));
  }

  public static String getStringValue(String key) {
    String str = null;

    try {
      str = new String(SETTINGS.getString(key).getBytes("ISO-8859-1"), "utf-8");
    } catch (UnsupportedEncodingException var3) {
      ;
    }

    return str;
  }

  public static boolean getBooleanValue(String key) {
    return Boolean.parseBoolean(SETTINGS.getString(key));
  }

  static {
    SETTINGS = ResourceBundle.getBundle("config/setting", rc);

    try {
      file = new File(Constants.class.getResource("/config/setting.properties").toURI());
    } catch (Exception var1) {
      log.error(var1.getMessage(), var1);
    }

    Thread t = new Thread(new Runnable() {
      public void run() {
        while(Constants.file != null) {
          try {
            if(Constants.file.lastModified() != Constants.lastModified) {
              Constants.SETTINGS = ResourceBundle.getBundle("config/setting", Constants.rc);
              Constants.lastModified = Constants.file.lastModified();
            }

            Thread.sleep(600000L);
          } catch (InterruptedException var2) {
            Constants.log.error(var2.getMessage(), var2);
          } catch (Throwable var3) {
            Constants.log.error(var3);
          }
        }

        Constants.log.error("Not found the file of \'/setting.properties\'.");
      }
    });
    t.start();
  }
}
